<%--
  Created by IntelliJ IDEA.
  User: 86177
  Date: 2021/11/22
  Time: 10:24
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <!--视口 自适应-->
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!--bootstrap样式 -->
    <link rel="stylesheet" href="resource/css/bootstrap.css">
    <script src="resource/js/jquery-3.2.1.js"></script>
    <!--bootstrap.js 必须放在jquery.js下面 -->
    <script src="resource/js/bootstrap.js"></script>
    <title>客户订单</title>
</head>
<form>
    订单编号:<input type="text" name="orderId" value="${l}" readonly="readonly">
    下单时间:<input type="date" name="orderDate"><br><br>
    仓库:<select name="orderCk">
            <option value="A仓库">A仓库</option>
            <option value="B仓库">B仓库</option>
            <option value="C仓库">C仓库</option>
            <option value="D仓库">D仓库</option>
    </select>
    订货人:<input type="text" name="orderDh"><br><br>
    库位:<input type="text" name="orderKw">
    物流单号:<input type="text" name="orderOdd"><br><br>
    总金额:<input type="text" name="orderMoney" onblur="money()"><span id="sp"></span>
    附件成本:<input type="text" name="orderImage"><br><br>
    折让金额:<input type="text" name="orderMon">
    制单人:<input type="text" name="orderName" value="${user.username}" readonly="readonly">
    支付方式:<select name="orderWay">
                <option value="送货上门">送货上门</option>
                <option value="自提自取">自提自取</option>
    </select>
    交货地点:<input type="text" name="orderAddress"><br><br>
    订单明细<br>
    <input type="button" value="增加" onclick="addTr()">
    <table class="table">
        <thead>
        <tr>
            <th scope="col">订单编号</th>
            <th scope="col">商品名称</th>
            <th scope="col">型号</th>
            <th scope="col">单价</th>
            <th scope="col">数量</th>
            <th scope="col">金额</th>
            <th scope="col">备注</th>
        </tr>
        </thead>
        <tbody>
        </tbody>
    </table>

    <input type="button" value="提交" onclick="tj()">

</form>
<body>
</body>
<script>
    var index = 0;
    function addTr(){
        $("tbody").append("<tr>"+
            " <th scope='row'><input type='text' name='goods['+index+'].goodsId'></th>"+
            " <td><input type='text' name='goods['+index+'].goodsName'></td>"+
            " <td><input type='text' name='goods['+index+'].goodsType'></td>"+
            " <td><input type='text' name='goods['+index+'].goodsPrice'></td>"+
            " <td><input type='text' name='goods['+index+'].goodsNum'></td>"+
            " <td><input type='text' name='goods['+index+'].goodsMoney'></td>"+
            " <td><input type='text' name='goods['+index+'].context'></td>"+
            "</tr>");
        index++;
    }

    function tj(){
        var url = "add?"+$('form').serialize();
        $("#nav-tabContent").load(url);
    }

    function money(){
        var money = $("[name='orderMoney']").val();
        var r_money = /^\d+(\.\d+)?$/
        if (money != null){
            $("#sp").val("不符合规范")
        }
        // if (!r_money.test(money)){
        //     $("#sp").val("不符合规范")
        // }
    }
</script>
</html>
